package sfy.md.structure.theflyweight.demo;

import sfy.md.structure.theflyweight.StoreManager;

import java.util.ArrayList;
import java.util.List;

public class ConnectionStore implements StoreManager<Connection> {

    List<Connection> list = new ArrayList<>();
    Config config =new Config();

    @Override
    public Connection getOne() {
        if(list!=null&&list.size()>0){
            return  list.get(0);
        }
        return null;
    }

    @Override
    public void setOne(Connection connection) {
      list.add(connection);
    }
}
